//
//  MineWeightDatePickerView.m
//  Shine
//
//  Created by dllo on 16/3/11.
//  Copyright © 2016年 王斌. All rights reserved.
//

#import "MineWeightDatePickerView.h"
#define WIDTHVIEW self.frame.size.width
#define HEIGHTVIEW self.frame.size.height
#define BGSVFSW self.backGroundSmallView.frame.size.width
#define BGSVFSH self.backGroundSmallView.frame.size.height
@implementation MineWeightDatePickerView

- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView{

    self.backGroundSmallView = [[UIView alloc] init];
    [self addSubview:self.backGroundSmallView];
    self.titleLabel = [[UILabel alloc] init];
    [self.backGroundSmallView addSubview:self.titleLabel];
    self.textFieldNumber = [[UITextField alloc] init];
    [self.backGroundSmallView addSubview:self.textFieldNumber];
    self.kgLabel = [[UILabel alloc] init];
    [self.backGroundSmallView addSubview:self.kgLabel];
    self.dateLabel = [[UILabel alloc] init];
    [self.backGroundSmallView addSubview:self.dateLabel];
    self.saveButton = [[UIButton alloc] init];
    [self.backGroundSmallView addSubview:self.saveButton];
    self.xButton = [[UIButton alloc] init];
    [self.backGroundSmallView addSubview:self.xButton];
    self.dateClickLabel = [[UILabel alloc] init];
    [self.backGroundSmallView addSubview:self.dateClickLabel];
    self.titleLineView = [[UIView alloc] init];
    [self.backGroundSmallView addSubview:self.titleLineView];
    self.kgLineView = [[UIView alloc] init];
    [self.backGroundSmallView addSubview:self.kgLineView];
    self.dateLineView = [[UIView alloc] init];
    [self.backGroundSmallView addSubview:self.dateLineView];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    
    self.backGroundSmallView.frame = CGRectMake(0, 0, WIDTHVIEW, HEIGHTVIEW);
    self.backGroundSmallView.backgroundColor = [UIColor blackColor];
    self.backGroundSmallView.alpha = 0.8;
    
    self.titleLabel.frame = CGRectMake(50, 10, 80, 20);
    self.titleLabel.center = CGPointMake(WIDTHVIEW/2, 20);
    self.titleLabel.textColor = [UIColor whiteColor];
    self.titleLabel.text = @"录入体重";
    
    self.titleLineView.frame = CGRectMake(50, 30, 70, 2);
    self.titleLineView.center = CGPointMake(WIDTHVIEW/2-5, 40);
    self.titleLineView.backgroundColor = [UIColor lightGrayColor];
    
    self.xButton.frame = CGRectMake(BGSVFSW-30, 5, 30, 30);
    [self.xButton setTitle:@"x" forState:UIControlStateNormal];
    [self.xButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    
    self.textFieldNumber.frame = CGRectMake(10, 55, BGSVFSW-30, 40);
    self.textFieldNumber.textColor = COLORYELLO;
    self.textFieldNumber.font = [UIFont systemFontOfSize:40];
    self.textFieldNumber.textAlignment = YES;
    
    self.kgLabel.frame = CGRectMake(BGSVFSW-30, 70, 20, 20);
    self.kgLabel.textColor = [UIColor whiteColor];
    self.kgLabel.text = @"kg";
    
    self.kgLineView.frame = CGRectMake(5, 95, BGSVFSW-10, 1);
    self.kgLineView.backgroundColor = [UIColor lightGrayColor];
    
    self.dateLabel.frame = CGRectMake(10, 105, 40, 20);
    self.dateLabel.textColor = [UIColor grayColor];
    self.dateLabel.text = @"日期";
    
    self.dateClickLabel.frame = CGRectMake(50, 100, BGSVFSW-40, 30);
    self.dateClickLabel.textAlignment = YES;
    self.dateClickLabel.textColor = [UIColor whiteColor];
    
    self.dateLineView.frame = CGRectMake(5, 130, BGSVFSW-10, 1);
    self.dateLineView.backgroundColor = [UIColor lightGrayColor];
    
    self.saveButton.frame = CGRectMake(15, BGSVFSH-40, BGSVFSW-30, 30);
    [self.saveButton setTitle:@"保存" forState:UIControlStateNormal];
    [self.saveButton setTitleColor:COLORYELLO forState:UIControlStateNormal];
    self.saveButton.layer.borderWidth = 1;
    self.saveButton.layer.cornerRadius = 5;
    self.saveButton.layer.masksToBounds = YES;
    self.saveButton.layer.borderColor = COLORYELLO.CGColor;
    
}


@end
